<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>EL表达式</title>
</head>
<body>
1.获取web.xml中配置的上下文参数：${initParam.name}
<br>
2.javaBean
<jsp:useBean id="student" class="com.niit.Student" scope="application"/>
<jsp:setProperty name="student" property="id" value="2023001" />
<jsp:setProperty name="student" property="name" value="xiuaohong" />
<jsp:setProperty name="student" property="age" value="20" />
<br>
学号: ${student.id}<br>
姓名：${student.name}<br>
年龄：${student.age}<br>
3.处理Null
<br> 
<!-- 未声明变量，不会引起异常 -->
${username}
<!-- El计算算术表达式，将NULL视为0 -->
${1+abc}
<!-- El计算逻辑表达式，将NULL视为false -->
${ 3 > num1}

<h2>4.EL扩展</h2>
<h3>四大域对象:page,request,session,application</h3>
<% pageContext.setAttribute("pageKey","zhangsan") ;%>
<h3>1.获取Page域信息：${pageScope.pageKey}</h3>
<h3>2.获取Request域信息：${requestScope.requestKey}</h3>
<h3>3.获取Session域信息：${sessionScope.sessionKey}</h3>
<h3>4.获取Application域信息：${applicationScope.applicationKey}</h3>

<h2>5.EL表达式获取URL中的请求参数</h2>
<!-- http://localhost:8080/Chapter8/el.jsp?username=admin&email=123435@qq.com -->
<h3>获取URL中的请求参数：用户名=${param.username}，邮箱=${param.email}</h3>
<h3>获取URL中的请求参数：${param.a}，${param.b}，${param.c}</h3>

<h2>6.EL表达式操作集合</h2>
<!-- 模拟数据 -->
<%
	java.util.List<String> strList = new java.util.ArrayList<>();
	strList.add("java");
	strList.add("mysql");
	strList.add("Html");
	strList.add("Spring");
	// 把数据放到页面中
	pageContext.setAttribute("strList", strList);
%>
<br>
${strList.get(0)}
<br>
${strList.get(1)}
<br>
${strList.get(2)}






</body>
</html>